package part15_中介者模式_智能家居;

/**
 * @ClassName: Alarm
 * @Author: AllenSun
 * @Date: 2020/3/8 22:26
 */
public class TV extends Colleague {

    public TV(Mediator mediator,String name) {
        super(name, mediator);
        //在创建Alarm同事对象时，把自己放入到ConcreteMediator对象中
        mediator.Register(name,this);
    }

    @Override
    public void SendMessage(int stateChange) {
        this.GetMediator().GetMessage(stateChange,this.name);
    }

    public void StartTv(){
        System.out.println("打开电视");
    }

    public void StopTv(){
        System.out.println("关闭电视");
    }

}
